package org.hijava.iplooking;

public class Utils {
	
	public static long getIpNumber(String ipStr){
		String[] ipArray=ipStr.split("\\.");
		return (Long.valueOf(ipArray[0])<<24)+(Long.valueOf(ipArray[1])<<16)
				+(Long.valueOf(ipArray[2])<<8)+Long.valueOf(ipArray[3]);
	}
	public static String getIpString(long ip){
		String ipStr="";
		int m=1<<8;
		for(int i=0;i<3;i++){
			ipStr="."+(ip%m)+ipStr;
			ip=ip/m;
		}
		return ip+ipStr;
	}
}
